using UnityEngine;
using System.Collections.Generic;

public class ContentPanel : HUDPanel
{
	public ButtonID buttonUsed;
	public RectTransform scrollContent;

	private List<GameObject> buttons = new List<GameObject>();
	
	public override void UpdatePanel(Character _character)
	{
		foreach (GameObject b in buttons)
		{
			PoolManager.Instance.ReturnToPool(b);
		}

		buttons.Clear();

		GameObject tempButton;
		CharacterInfo info = _character.GetInfo<CharacterInfo>();
		foreach (InteractiveInfo content in info.contents)
		{
			tempButton = PoolManager.Instance.GetFromPool(buttonUsed.ToString());
			ScreensManager.Instance.SetParent(tempButton, scrollContent);
			tempButton.GetComponent<ButtonInteractive>().Setup(_character as Player, content, true, false);
			buttons.Add(tempButton);
		}
	}
}
